//
//  MusicBottomView.swift
//  FirstSwiftProduct
//
//  Created by 知合金服-Mini on 2017/12/21.
//  Copyright © 2017年 范泽华. All rights reserved.
//

import UIKit

class MusicBottomView: UIView {

    let buttonCount = 9
    
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        let buttonWidth = (SCREEN_WIDTH - 80 - 20) / CGFloat(buttonCount-1)
        
        for i in 0...(buttonCount - 1) {
            let button = UIButton.init(type: .system)
            if i%2 == 0{
                if i > 5 {
                    button.frame = CGRect(x: 60 + (buttonWidth * CGFloat(i)), y: 0, width: buttonWidth, height: buttonWidth)
                }else if (i < 3){
                    button.frame = CGRect(x: 10 + (buttonWidth * CGFloat(i)), y: 0, width: buttonWidth, height: buttonWidth)
                }
                
                button.centerY = frame.height/2
            }else{
                if i == 3{
                    button.frame = CGRect(x: frame.width/2-40, y: 0, width: 80, height: 80)
                }
            }
            button.backgroundColor = .black
            button.centerY = frame.height/2
            button.setTitle("title", for: .normal)
            button.setTitleColor(.red, for: .normal)
            self.addSubview(button)
        }
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
